import { S } from '../../s';
import { IPSAppCodeList } from '../../app/codelist/ipsapp-code-list';
import { IPSAppDEField } from '../../app/dataentity/ipsapp-defield';
import { IPSDEDataViewDataItem } from './ipsdedata-view-data-item';
import { PSDataItemImpl } from '../../data/psdata-item-impl';

export class PSDEDataViewDataItemImpl
  extends PSDataItemImpl
  implements IPSDEDataViewDataItem
{
  protected frontpscodelist: IPSAppCodeList;
  getFrontPSCodeList(): IPSAppCodeList | null {
    return (
      this.frontpscodelist ||
      (this.frontpscodelist = this.fillObjectModel(
        S._8,
        this.M.getFrontPSCodeList,
        S._376,
      ) as IPSAppCodeList)
    );
  }

  protected psappdefield: IPSAppDEField;
  getPSAppDEField(): IPSAppDEField | null {
    return (
      this.psappdefield ||
      (this.psappdefield = this.fillObjectModel(
        S._1,
        this.M.getPSAppDEField,
        S._2e4,
      ) as IPSAppDEField)
    );
  }

  get scriptCode(): string {
    return this.M.scriptCode;
  }

  get customCode(): boolean {
    return this.M.customCode != null ? this.M.customCode : false;
  }
  get cls(): string {
    return 'PSDEDataViewDataItemImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._28d) return true;
    return super.instanceof(cls);
  }
}
